/*    */ package com.zimbra.cs.account.ldap.upgrade;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Config;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import com.zimbra.cs.ldap.LdapClient;
/*    */ import com.zimbra.cs.ldap.LdapServerType;
/*    */ import com.zimbra.cs.ldap.LdapUsage;
/*    */ import com.zimbra.cs.ldap.ZLdapContext;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BUG_63475
/*    */   extends UpgradeOp
/*    */ {
/*    */   void doUpgrade()
/*    */     throws ServiceException
/*    */   {
/* 37 */     ZLdapContext zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.UPGRADE);
/*    */     try {
/* 39 */       doGlobalConfig(zlc);
/* 40 */       doAllServers(zlc);
/*    */     } finally {
/* 42 */       LdapClient.closeContext(zlc);
/*    */     }
/*    */   }
/*    */   
/*    */   private void doEntry(ZLdapContext zlc, Entry entry, String entryName) throws ServiceException {
/* 47 */     String attrName = "zimbraMailSSLProxyClientCertPort";
/* 48 */     String oldDefaultValue = "0";
/* 49 */     String newDefaultValue = "3443";
/*    */     
/* 51 */     this.printer.println();
/* 52 */     this.printer.println("------------------------------");
/* 53 */     this.printer.println("Checking " + attrName + " on " + entryName);
/*    */     
/* 55 */     String curValue = entry.getAttr(attrName, false);
/* 56 */     if (oldDefaultValue.equals(curValue)) {
/* 57 */       this.printer.println("    Changing " + attrName + " on " + entryName + " from " + curValue + " to " + newDefaultValue);
/*    */       
/*    */ 
/* 60 */       Map<String, Object> attr = new HashMap();
/* 61 */       attr.put(attrName, newDefaultValue);
/*    */       try {
/* 63 */         modifyAttrs(zlc, entry, attr);
/*    */       }
/*    */       catch (ServiceException e) {
/* 66 */         this.printer.println("Caught ServiceException while modifying " + entryName + " attribute " + attr);
/* 67 */         this.printer.printStackTrace(e);
/*    */       }
/*    */     } else {
/* 70 */       this.printer.println("    Current value of " + attrName + " on " + entryName + " is " + curValue + " - not changed");
/*    */     }
/*    */   }
/*    */   
/*    */   private void doGlobalConfig(ZLdapContext zlc) throws ServiceException
/*    */   {
/* 76 */     Config config = this.prov.getConfig();
/* 77 */     doEntry(zlc, config, "global config");
/*    */   }
/*    */   
/*    */   private void doAllServers(ZLdapContext zlc) throws ServiceException {
/* 81 */     List<Server> servers = this.prov.getAllServers();
/* 82 */     for (Server server : servers) {
/* 83 */       doEntry(zlc, server, "server " + server.getName());
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/ldap/upgrade/BUG_63475.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */